package edu.gatech.volt2.drdoommgt.gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.util.Calendar;
import java.util.List;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.SpringLayout;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import edu.gatech.volt2.drdoommgt.domain.Doctor;
import edu.gatech.volt2.drdoommgt.domain.Nurse;
import java.awt.Color;

public class TreatmentRecordDetails extends JFrame implements ItreatmentRecordView {

	private JPanel contentPane;
	private JButton okButton;
	private JButton cancelButton;
	private JTextField complaintField;
	private JTextField diagnosisField;
	private JTextField followUpField;
	private JTextArea txtrNotes;
	private JButton addPrescriptionButton;
	private JButton addLabworkButton;
	private JButton removePrescriptionButton;
	private JButton removeLabworkButton;
	
	/**
	 * @return the ok button
	 */
	public JButton getOkButton(){
		return okButton;
	}
	
	/**
	 * @return the cancel button
	 */
	public JButton getCancelButton(){
		return cancelButton;
	}
	

	@Override
	public JButton getAddLabworkButton() {
		return addLabworkButton;

	}

	@Override
	public JButton getRemoveLabworkButton() {
		return removeLabworkButton;

	}

	@Override
	public JButton getAddPrescriptionButton() {
		return addPrescriptionButton;
	}

	@Override
	public JButton getRemovePrescriptionButton() {
		return removePrescriptionButton;

	}

	/**
	 * @return the complaintField
	 */
	public JTextField getComplaintField() {
		return complaintField;
	}

	/**
	 * @param complaintField the complaintField to set
	 */
	public void setComplaintField(JTextField complaintField) {
		this.complaintField = complaintField;
	}

	/**
	 * @return the diagnosisField
	 */
	public JTextField getDiagnosisField() {
		return diagnosisField;
	}

	/**
	 * @param diagnosisField the diagnosisField to set
	 */
	public void setDiagnosisField(JTextField diagnosisField) {
		this.diagnosisField = diagnosisField;
	}

	/**
	 * @return the followUpField
	 */
	public JTextField getFollowUpField() {
		return followUpField;
	}

	/**
	 * @param followUpField the followUpField to set
	 */
	public void setFollowUpField(JTextField followUpField) {
		this.followUpField = followUpField;
	}

	/**
	 * @return the txtrNotes
	 */
	public JTextArea getTxtrNotes() {
		return txtrNotes;
	}

	/**
	 * @param txtrNotes the txtrNotes to set
	 */
	public void setTxtrNotes(JTextArea txtrNotes) {
		this.txtrNotes = txtrNotes;
	}

	/**
	 * @return the doctorField
	 */
	public JComboBox getDoctorField() {
		return doctorField;
	}

	/**
	 * @param doctorField the doctorField to set
	 */
	public void setDoctorField(JComboBox doctorField) {
		this.doctorField = doctorField;
	}

	/**
	 * @return the prescriptionList
	 */
	public DefaultListModel getPrescriptionList() {
		return prescriptionListModel;
	}

	/**
	 * @param prescriptionList the prescriptionList to set
	 */
	public void setPrescriptionList(JList prescriptionList) {
		this.prescriptionList = prescriptionList;
	}

	/**
	 * @return the labworkList
	 */
	public DefaultListModel getLabworkList() {
		return labworkListModel;
	}

	/**
	 * @param labworkList the labworkList to set
	 */
	public void setLabworkList(JList labworkList) {
		this.labworkList = labworkList;
	}

	/**
	 * @return the nurseField
	 */
	public JComboBox getNurseField() {
		return nurseField;
	}

	/**
	 * @param nurseField the nurseField to set
	 */
	public void setNurseField(JComboBox nurseField) {
		this.nurseField = nurseField;
	}

	private JComboBox doctorField;
	private JList prescriptionList;
	private JList labworkList;
	private JComboBox nurseField;
	private DefaultListModel prescriptionListModel;
	private DefaultListModel labworkListModel;
	private JComboBox whenMonth;
	private JComboBox whenDay;
	private JComboBox whenYear;
	private JTextField weight;
	private JTextField blood_s;
	private JTextField blood_d;
	private JTextField temperature;
	private JTextField pulse;
	private JComboBox heightFeet;
	private JComboBox heightInches;
	
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TreatmentRecordDetails frame = new TreatmentRecordDetails();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public TreatmentRecordDetails() {
		setResizable(false);
		setTitle("Dr. Doom Management");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 660);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		
		JPanel button_panel = new JPanel();
		contentPane.add(button_panel, BorderLayout.SOUTH);
		button_panel.setLayout(new BorderLayout(0, 0));
		
		okButton = new JButton("Save");
		button_panel.add(okButton, BorderLayout.EAST);
		
		cancelButton = new JButton("Cancel");
		button_panel.add(cancelButton, BorderLayout.WEST);
		
		JLabel lblNewLabel = new JLabel("Treatment Record Information");
		lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
		contentPane.add(lblNewLabel, BorderLayout.NORTH);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		SpringLayout sl_panel = new SpringLayout();
		panel.setLayout(sl_panel);
		
		JLabel dateLabelLabel = new JLabel("Date:");
		sl_panel.putConstraint(SpringLayout.NORTH, dateLabelLabel, 10, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.WEST, dateLabelLabel, 25, SpringLayout.WEST, panel);
		panel.add(dateLabelLabel);
		
		JLabel doctorLabel = new JLabel("Doctor:");
		sl_panel.putConstraint(SpringLayout.NORTH, doctorLabel, 14, SpringLayout.SOUTH, dateLabelLabel);
		sl_panel.putConstraint(SpringLayout.WEST, doctorLabel, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(doctorLabel);
		
		JLabel nurseLabel = new JLabel("Nurse:");
		sl_panel.putConstraint(SpringLayout.NORTH, nurseLabel, 14, SpringLayout.SOUTH, doctorLabel);
		sl_panel.putConstraint(SpringLayout.WEST, nurseLabel, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(nurseLabel);
		
		JLabel lblComplaint = new JLabel("Complaint:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblComplaint, 14, SpringLayout.SOUTH, nurseLabel);
		sl_panel.putConstraint(SpringLayout.WEST, lblComplaint, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblComplaint);
		
		JLabel lblNewLabel_3 = new JLabel("Diagnosis:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNewLabel_3, 14, SpringLayout.SOUTH, lblComplaint);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel_3, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblNewLabel_3);
		
		JLabel lblNewLabel_5 = new JLabel("Follow Up:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNewLabel_5, 14, SpringLayout.SOUTH, lblNewLabel_3);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel_5, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblNewLabel_5);
		
		JLabel lblNewLabel_7 = new JLabel("Notes:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNewLabel_7, 14, SpringLayout.SOUTH, lblNewLabel_5);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel_7, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblNewLabel_7);
		
		JLabel lblNewLabel_9 = new JLabel("Prescription:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNewLabel_9, 54, SpringLayout.SOUTH, lblNewLabel_7);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel_9, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblNewLabel_9);
		
		JLabel lblNewLabel_10 = new JLabel("Lab Work:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNewLabel_10, 54, SpringLayout.SOUTH, lblNewLabel_9);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel_10, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblNewLabel_10);
		
		complaintField = new JTextField();
		sl_panel.putConstraint(SpringLayout.WEST, complaintField, 35, SpringLayout.EAST, lblComplaint);
		sl_panel.putConstraint(SpringLayout.EAST, complaintField, -31, SpringLayout.EAST, panel);
		panel.add(complaintField);
		complaintField.setColumns(10);
		
		diagnosisField = new JTextField();
		sl_panel.putConstraint(SpringLayout.NORTH, diagnosisField, 2, SpringLayout.SOUTH, complaintField);
		sl_panel.putConstraint(SpringLayout.WEST, diagnosisField, 37, SpringLayout.EAST, lblNewLabel_3);
		sl_panel.putConstraint(SpringLayout.EAST, diagnosisField, -31, SpringLayout.EAST, panel);
		panel.add(diagnosisField);
		diagnosisField.setColumns(10);
		
		followUpField = new JTextField();
		sl_panel.putConstraint(SpringLayout.NORTH, followUpField, 2, SpringLayout.SOUTH, diagnosisField);
		sl_panel.putConstraint(SpringLayout.WEST, followUpField, 38, SpringLayout.EAST, lblNewLabel_5);
		sl_panel.putConstraint(SpringLayout.EAST, followUpField, -31, SpringLayout.EAST, panel);
		panel.add(followUpField);
		followUpField.setColumns(10);
		
		txtrNotes = new JTextArea();
		txtrNotes.setWrapStyleWord(true);
		txtrNotes.setBackground(Color.WHITE);
		txtrNotes.setLineWrap(true);
		sl_panel.putConstraint(SpringLayout.NORTH, txtrNotes, 8, SpringLayout.SOUTH, followUpField);
		sl_panel.putConstraint(SpringLayout.WEST, txtrNotes, 63, SpringLayout.EAST, lblNewLabel_7);
		sl_panel.putConstraint(SpringLayout.SOUTH, txtrNotes, -329, SpringLayout.SOUTH, panel);
		sl_panel.putConstraint(SpringLayout.EAST, txtrNotes, -31, SpringLayout.EAST, panel);
		panel.add(txtrNotes);
		
		doctorField = new JComboBox();
		sl_panel.putConstraint(SpringLayout.NORTH, doctorField, 35, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.WEST, doctorField, 57, SpringLayout.EAST, doctorLabel);
		sl_panel.putConstraint(SpringLayout.EAST, doctorField, -31, SpringLayout.EAST, panel);
		doctorField.setEnabled(false);
		sl_panel.putConstraint(SpringLayout.NORTH, complaintField, 32, SpringLayout.SOUTH, doctorField);
		panel.add(doctorField);
		
		prescriptionList = new JList();
		sl_panel.putConstraint(SpringLayout.NORTH, prescriptionList, 6, SpringLayout.SOUTH, txtrNotes);
		sl_panel.putConstraint(SpringLayout.WEST, prescriptionList, 25, SpringLayout.EAST, lblNewLabel_9);
		sl_panel.putConstraint(SpringLayout.EAST, prescriptionList, -31, SpringLayout.EAST, panel);
		prescriptionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		prescriptionListModel = new DefaultListModel();
		prescriptionList.setModel(prescriptionListModel);
		panel.add(prescriptionList);
		
		labworkList = new JList();
		sl_panel.putConstraint(SpringLayout.NORTH, labworkList, 330, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, prescriptionList, -6, SpringLayout.NORTH, labworkList);
		sl_panel.putConstraint(SpringLayout.WEST, labworkList, 0, SpringLayout.WEST, complaintField);
		sl_panel.putConstraint(SpringLayout.EAST, labworkList, -31, SpringLayout.EAST, panel);
		labworkList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		labworkListModel = new DefaultListModel();
		labworkList.setModel(labworkListModel);
		panel.add(labworkList);
		
		nurseField = new JComboBox();
		sl_panel.putConstraint(SpringLayout.WEST, nurseField, 63, SpringLayout.EAST, nurseLabel);
		sl_panel.putConstraint(SpringLayout.EAST, nurseField, -31, SpringLayout.EAST, panel);
		nurseField.setEnabled(false);
		sl_panel.putConstraint(SpringLayout.SOUTH, nurseField, -2, SpringLayout.NORTH, complaintField);
		panel.add(nurseField);
		
		addPrescriptionButton = new JButton("+");
		addPrescriptionButton.setEnabled(false);
		sl_panel.putConstraint(SpringLayout.NORTH, addPrescriptionButton, 6, SpringLayout.SOUTH, lblNewLabel_9);
		sl_panel.putConstraint(SpringLayout.WEST, addPrescriptionButton, 67, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, addPrescriptionButton, 27, SpringLayout.SOUTH, lblNewLabel_9);
		sl_panel.putConstraint(SpringLayout.EAST, addPrescriptionButton, 0, SpringLayout.EAST, lblComplaint);
		panel.add(addPrescriptionButton);
		
		
		removePrescriptionButton = new JButton("-");
		sl_panel.putConstraint(SpringLayout.NORTH, removePrescriptionButton, 6, SpringLayout.SOUTH, lblNewLabel_9);
		sl_panel.putConstraint(SpringLayout.WEST, removePrescriptionButton, 31, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, removePrescriptionButton, -27, SpringLayout.NORTH, lblNewLabel_10);
		sl_panel.putConstraint(SpringLayout.EAST, removePrescriptionButton, 0, SpringLayout.EAST, dateLabelLabel);
		removePrescriptionButton.setEnabled(false);
		panel.add(removePrescriptionButton);
		
		addLabworkButton = new JButton("+");
		addLabworkButton.setEnabled(false);
		sl_panel.putConstraint(SpringLayout.NORTH, addLabworkButton, 6, SpringLayout.SOUTH, lblNewLabel_10);
		sl_panel.putConstraint(SpringLayout.WEST, addLabworkButton, 0, SpringLayout.WEST, addPrescriptionButton);
		sl_panel.putConstraint(SpringLayout.SOUTH, addLabworkButton, 27, SpringLayout.SOUTH, lblNewLabel_10);
		sl_panel.putConstraint(SpringLayout.EAST, addLabworkButton, 0, SpringLayout.EAST, lblComplaint);
		panel.add(addLabworkButton);
		
		removeLabworkButton = new JButton("-");
		sl_panel.putConstraint(SpringLayout.NORTH, removeLabworkButton, 6, SpringLayout.SOUTH, lblNewLabel_10);
		sl_panel.putConstraint(SpringLayout.WEST, removeLabworkButton, -36, SpringLayout.WEST, addPrescriptionButton);
		sl_panel.putConstraint(SpringLayout.SOUTH, removeLabworkButton, 43, SpringLayout.NORTH, lblNewLabel_10);
		sl_panel.putConstraint(SpringLayout.EAST, removeLabworkButton, 0, SpringLayout.EAST, dateLabelLabel);
		removeLabworkButton.setEnabled(false);
		panel.add(removeLabworkButton);
		
		whenMonth = new JComboBox();
		sl_panel.putConstraint(SpringLayout.NORTH, whenMonth, -5, SpringLayout.NORTH, dateLabelLabel);
		sl_panel.putConstraint(SpringLayout.WEST, whenMonth, 0, SpringLayout.WEST, complaintField);
		panel.add(whenMonth);
		
		whenDay = new JComboBox();
		sl_panel.putConstraint(SpringLayout.WEST, whenDay, 220, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.EAST, whenMonth, -6, SpringLayout.WEST, whenDay);
		sl_panel.putConstraint(SpringLayout.NORTH, whenDay, -5, SpringLayout.NORTH, dateLabelLabel);
		panel.add(whenDay);
		
		whenYear = new JComboBox();
		sl_panel.putConstraint(SpringLayout.EAST, whenDay, -6, SpringLayout.WEST, whenYear);
		sl_panel.putConstraint(SpringLayout.NORTH, whenYear, -5, SpringLayout.NORTH, dateLabelLabel);
		sl_panel.putConstraint(SpringLayout.WEST, whenYear, -90, SpringLayout.EAST, complaintField);
		sl_panel.putConstraint(SpringLayout.EAST, whenYear, 0, SpringLayout.EAST, complaintField);
		panel.add(whenYear);
		
		JLabel lblVitalSigns = new JLabel("Height:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblVitalSigns, 44, SpringLayout.SOUTH, addLabworkButton);
		sl_panel.putConstraint(SpringLayout.WEST, lblVitalSigns, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblVitalSigns);
		
		heightFeet = new JComboBox();
		sl_panel.putConstraint(SpringLayout.SOUTH, labworkList, -27, SpringLayout.NORTH, heightFeet);
		sl_panel.putConstraint(SpringLayout.NORTH, heightFeet, -5, SpringLayout.NORTH, lblVitalSigns);
		sl_panel.putConstraint(SpringLayout.WEST, heightFeet, 0, SpringLayout.WEST, complaintField);
		sl_panel.putConstraint(SpringLayout.EAST, heightFeet, 0, SpringLayout.EAST, whenMonth);
		panel.add(heightFeet);
		
		heightInches = new JComboBox();
		sl_panel.putConstraint(SpringLayout.NORTH, heightInches, -5, SpringLayout.NORTH, lblVitalSigns);
		sl_panel.putConstraint(SpringLayout.WEST, heightInches, 0, SpringLayout.WEST, whenDay);
		sl_panel.putConstraint(SpringLayout.EAST, heightInches, -141, SpringLayout.EAST, panel);
		panel.add(heightInches);
		
		JLabel lblWeight = new JLabel("Weight:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblWeight, 24, SpringLayout.SOUTH, lblVitalSigns);
		sl_panel.putConstraint(SpringLayout.WEST, lblWeight, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblWeight);
		
		weight = new JTextField();
		sl_panel.putConstraint(SpringLayout.NORTH, weight, -6, SpringLayout.NORTH, lblWeight);
		sl_panel.putConstraint(SpringLayout.WEST, weight, 0, SpringLayout.WEST, complaintField);
		sl_panel.putConstraint(SpringLayout.EAST, weight, 136, SpringLayout.EAST, lblWeight);
		panel.add(weight);
		weight.setColumns(10);
		
		JLabel lblLbs = new JLabel("lbs");
		sl_panel.putConstraint(SpringLayout.NORTH, lblLbs, 0, SpringLayout.NORTH, lblWeight);
		sl_panel.putConstraint(SpringLayout.WEST, lblLbs, 0, SpringLayout.WEST, whenDay);
		panel.add(lblLbs);
		
		blood_s = new JTextField();
		sl_panel.putConstraint(SpringLayout.WEST, blood_s, 0, SpringLayout.WEST, complaintField);
		sl_panel.putConstraint(SpringLayout.EAST, blood_s, 198, SpringLayout.WEST, panel);
		panel.add(blood_s);
		blood_s.setColumns(10);
		
		blood_d = new JTextField();
		sl_panel.putConstraint(SpringLayout.EAST, blood_d, -151, SpringLayout.EAST, panel);
		sl_panel.putConstraint(SpringLayout.NORTH, blood_s, 0, SpringLayout.NORTH, blood_d);
		sl_panel.putConstraint(SpringLayout.NORTH, blood_d, 15, SpringLayout.SOUTH, lblLbs);
		blood_d.setColumns(10);
		panel.add(blood_d);
		
		JLabel label = new JLabel("/");
		sl_panel.putConstraint(SpringLayout.WEST, blood_d, 6, SpringLayout.EAST, label);
		sl_panel.putConstraint(SpringLayout.NORTH, label, 6, SpringLayout.SOUTH, weight);
		sl_panel.putConstraint(SpringLayout.WEST, label, 6, SpringLayout.EAST, blood_s);
		label.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
		panel.add(label);
		
		JLabel lblNewLabel_1 = new JLabel("Blood Pressure:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNewLabel_1, 6, SpringLayout.NORTH, blood_s);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel_1, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblNewLabel_1);
		
		JLabel lblTemperature = new JLabel("Temperature:");
		sl_panel.putConstraint(SpringLayout.NORTH, lblTemperature, 17, SpringLayout.SOUTH, lblNewLabel_1);
		sl_panel.putConstraint(SpringLayout.WEST, lblTemperature, 0, SpringLayout.WEST, dateLabelLabel);
		panel.add(lblTemperature);
		
		temperature = new JTextField();
		sl_panel.putConstraint(SpringLayout.NORTH, temperature, 6, SpringLayout.SOUTH, blood_s);
		sl_panel.putConstraint(SpringLayout.WEST, temperature, 21, SpringLayout.EAST, lblTemperature);
		sl_panel.putConstraint(SpringLayout.EAST, temperature, 114, SpringLayout.EAST, lblTemperature);
		panel.add(temperature);
		temperature.setColumns(10);
		
		JLabel lblPulse = new JLabel("Heart Rate:");
		sl_panel.putConstraint(SpringLayout.WEST, lblPulse, 0, SpringLayout.WEST, dateLabelLabel);
		sl_panel.putConstraint(SpringLayout.SOUTH, lblPulse, -10, SpringLayout.SOUTH, panel);
		panel.add(lblPulse);
		
		pulse = new JTextField();
		sl_panel.putConstraint(SpringLayout.WEST, pulse, 0, SpringLayout.WEST, complaintField);
		sl_panel.putConstraint(SpringLayout.SOUTH, pulse, 0, SpringLayout.SOUTH, panel);
		sl_panel.putConstraint(SpringLayout.EAST, pulse, 0, SpringLayout.EAST, whenMonth);
		panel.add(pulse);
		pulse.setColumns(10);
		
		this.setCalOptions();
	}
	
	private void setCalOptions(){
		Calendar cal = Calendar.getInstance();
		for ( int month=1;month<=12;month++ ){
			whenMonth.addItem(month);
			if( month == (cal.get(Calendar.MONTH)+1)){
				whenMonth.setSelectedItem(month);
			}
		}
		for ( int days=1;days<=31;days++ ){
			whenDay.addItem(days);
			if( days == (cal.get(Calendar.DAY_OF_MONTH))){
				whenDay.setSelectedItem(days);
			}
		}
		for (int year=cal.get(Calendar.YEAR);year<(cal.get(Calendar.YEAR)+2);year++){
			whenYear.addItem(year);
		}
		
		
		for ( int i=0; i<10; i++ ){
			heightFeet.addItem(new Integer(i));
		}
		for ( int i=0; i<13; i++ ){
			heightInches.addItem(new Integer(i));
		}
		
	}
	

	@Override
	public void showSelf() {
		this.setVisible(true);
	}

	@Override
	public void addListener(ActionListener al) {
		okButton.addActionListener(al);
		cancelButton.addActionListener(al);
		addLabworkButton.addActionListener(al);
		removeLabworkButton.addActionListener(al);
		addPrescriptionButton.addActionListener(al);
		removePrescriptionButton.addActionListener(al);
	}

	@Override
	public void hideSelf() {
		this.setVisible(false);	
	}
	
	
	public void setDoctorList(List<Doctor> docs){
		for ( Doctor addDoc : docs ){
			doctorField.addItem(addDoc);
		}
	}
	
	public void setNurseList(List<Nurse> nurses){
		for ( Nurse addNurse : nurses ){
			nurseField.addItem(addNurse);
		}
	}
	
	@Override
	public Calendar getDate() {
		Calendar cal = Calendar.getInstance();
		int year = Integer.parseInt(whenYear.getSelectedItem().toString());
		int month = Integer.parseInt(whenMonth.getSelectedItem().toString());
		int date = Integer.parseInt(whenDay.getSelectedItem().toString());
		cal.set(year, month, date);
		return cal;
	}
	
	@Override
	public void enableDoctorList() {
		doctorField.setEnabled(true);
		
	}

	@Override
	public void enableNurseList() {
		nurseField.setEnabled(true);
	}

	@Override
	public void enableEditPrescription() {
		addPrescriptionButton.setEnabled(true);
		removePrescriptionButton.setEnabled(true);
	}

	@Override
	public void enableEditLabwork() {
		addLabworkButton.setEnabled(true);
		removeLabworkButton.setEnabled(true);
	}

	@Override
	public void setSelectedDoctor(Doctor doc) {
		doctorField.setSelectedItem(doc);	
	}

	@Override
	public void setSelectedNurse(Nurse nurse) {
		nurseField.setSelectedItem(nurse);
	}

	@Override
	public JList getPrescriptionListList() {
		return this.prescriptionList;
	}

	@Override
	public JList getLabworkListList() {
		return this.labworkList;
	}
	
	public String getNotes(){
		return txtrNotes.getText();
	}

	@Override
	public int getHeightFeet() {
		return Integer.parseInt(this.heightFeet.getSelectedItem().toString());
	}

	@Override
	public int getHeightInches() {
		return Integer.parseInt(this.heightInches.getSelectedItem().toString());
	}

	@Override
	public int getWeight() {
		return Integer.parseInt(this.weight.getText());
	}

	@Override
	public double getTemperature() {
		return Double.parseDouble(this.temperature.getText());
	}

	@Override
	public int getPulse() {
		return Integer.parseInt(this.pulse.getText());
	}

	@Override
	public String getBloodPressue() {
		return this.blood_s.getText()+"/"+this.blood_d.getText();
	}

	@Override
	public void disableDocOrder() {
		this.addLabworkButton.setEnabled(false);
		this.removeLabworkButton.setEnabled(false);
		this.labworkList.setEnabled(false);
		this.addPrescriptionButton.setEnabled(false);
		this.removePrescriptionButton.setEnabled(false);
		this.prescriptionList.setEnabled(false);
		this.followUpField.setEnabled(false);
		this.diagnosisField.setEnabled(false);
	}
}
